#opening the gene info file
open(X_GENE,"gunzip -c Homo_sapiens.gene_info.gz |cut -f2,3,7 |") or die "no file found Homo_sapiens.gene_info.gz\n";
$header=<X_GENE>;
chomp($header);
$num=0;
while(<X_GENE>)
{
	chomp($_);
	#die $_."\n";
	@array=split("\t",$_);
	#die "$array[0] $array[1] $array[2]\n";
	if($array[2] eq "X")
	{
		$num++;
		$hash{$array[0]}="$array[1] $array[2]";
	}
}
#die $num."\n";
#opening the expression file
open(BUFF,"mrna_ebayes_result.txt") or die "no file exists mrna_ebayes_result.txt\n";
open(WRBUFF,">Xchr_mrna_ebayes_result.txt") or die "not able to write the file Xchr_mrna_ebayes_result.txt\n";
$header=<BUFF>;
$header=~ s/"//g;
chomp($header);
$header="$header\tGeneName\tChromosome\n";
print WRBUFF $header;
while(<BUFF>)
{
	chomp($_);
	$_=~ s/"//g;	
	@array=split("\t",$_);
	if(exists($hash{$array[0]}))
	{
		print WRBUFF $_."\t$hash{$array[0]}\n";
	}
}
close(BUFF);
close(WRBUFF);
